<?php
namespace apps\home\controller;
use think\Log;

class Index 
{
    public function index()
    {   
        Log::info("ces cesdsdsdd:".input('des'));     
        return json_encode(['code'=>0, 'msg'=>'登录首页'],320);
    }
	
	public function q_login(){
        $code = input('code');
        Log::info("ces code:".input('code'));     
		return json_encode(['code'=>0, 'token'=>$code,'user'=>['openId'=>'147369','id'=>'123'],'msg'=>'登录检查'],320);
    }

    public function s_list(){
        $list = array(
            ['title'=>"调查女人购买情况",'joinNum'=>10,'id'=>111],['title'=>"调查深圳房价为什么那么高",'joinNum'=>10,'id'=>123]
        );
        return json_encode(['code'=>0, 'list'=>$list,'msg'=>'列表'],320);
    }
    public function s_id_one($id =''){
        Log::info("详情ID：".$id);
        $question = ['title'=>'调查女人购买情况','id'=>'111','des'=>'她当时就说那么多店铺都转让，还好去年没用做生意'];
        $psqlist = array(
            ['isMust'=>1,'id'=>'111','myOrder'=>1,'type'=>'1','question'=>'你认为美国谁是下任老大？',
                'answerslist'=>[
                    ['id'=>'555','answer'=>'特斯拉'],
                    ['id'=>'666','answer'=>'特朗普'],
                    ['id'=>'777','answer'=>'拜登']
                ]
            ],
            ['isMust'=>0,'id'=>'222','myOrder'=>1,'type'=>'1','question'=>'美国很牛逼吗？',
            'answerslist'=>[
                ['id'=>'555','answer'=>'不是'],
                ['id'=>'666','answer'=>'是'],
                ['id'=>'777','answer'=>'和我有关系吗']
            ]
            ],
            ['isMust'=>0,'id'=>'222','myOrder'=>1,'type'=>'0','question'=>'来乱写点东西给朕看看']
        );
        $question['psqlist'] = $psqlist;
        return json_encode(['code'=>0, 'data'=>$question,'msg'=>'详情'],320);
    }
    public function s_id_two(){
        
    }
    public function s_id_three(){

    }
    public function u_edit(){
        $nickName = input('nickName');
        $avatarUrl = input('avatarUrl');
        $gender = input('gender');
        Log::info("nickName:".$nickName);   
        return json_encode(['code'=>0, 'msg'=>'保存昵称'],320);
    }
    public function save(){
        $nickName = input('des');

        Log::info("des:".$nickName);   
        return json_encode(['code'=>0,'msg'=>'成功'],320);
    }
}
